import {
  GetUserPlayList,
  GetPlayListCreate,
  GetPlayListDelete,
  GetPlayListNameUpdate,
} from "apis/index";
import { showToast } from "utils/index";
import { appInfo } from "config/index";
const app = getApp();
Page({
  data: {
    appInfo,
    entrys: [{ icon: "", text: "最近播放" }],
    showPopup: false,
    showMorePopup: false,
    userInfo: null,
  },

  onLoad(options) {},
  onShow() {
    this.setData({
      userInfo: app.globalData.userInfo,
    });
  },
  onShareAppMessage() {},
  openPopup() {
    this.setData({
      showPopup: true,
    });
  },
  openMorePopup() {
    this.setData({
      showMorePopup: true,
    });
  },
  //获取用户播放歌单
  getPlayList() {
    GetUserPlayList({ uid: "" }).then((res) => {
      console.log("getPlayList-res-----------", res);
    });
  },
  //新建歌单
  createPlayList() {
    GetPlayListCreate({ name: "歌单名" }).then((res) => {
      console.log(res, "createPlayList-res-----");
      showToast("新建歌单名成功", "success");
    });
  },
  //删除歌单
  deletePlayList() {
    GetPlayListDelete({ id: "歌单id" }).then((res) => {
      console.log(res, "createPlayList-res-----");
      showToast("删除歌单成功", "success");
    });
  },
  //更新歌单名
  updatePlayListName() {
    GetPlayListNameUpdate({ id: "歌单id", name: "歌单名" }).then((res) => {
      console.log(res, "updatePlayListName-res------");
      showToast("歌单名更新成功", "success");
    });
  },
});
